﻿using UnityEngine;
using System.Collections;

public class Mini_map : MonoBehaviour
{
	private Transform target = null;
	[SerializeField]
	private Camera cam;
	
	void Awake ()
	{
		Gamecontrol.Instance.e_leader_change += delegate()
		{
			target = Gamecontrol.Instance.player_leader.transform;
		};
		Gamecontrol.Instance.e_startgame += delegate()
		{
			gameObject.SetActive(true);
		};
		gameObject.SetActive(false);
	}
	// Use this for initialization
	void Start()
	{

	}
	
	// Update is called once per frame
	void Update ()
	{
		if (target != null)
		{
			cam.transform.position = new Vector3(target.position.x, cam.transform.position.y, target.position.z);
		}
	}

	public void Plus()
	{
		cam.orthographicSize -= 1;
	}
	public void Minus()
	{
		cam.orthographicSize += 1;
	}
	public void setting()
	{

	}
}
